/*
package com.gongyibao.gbase.controller;

import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.TimeUnit;

*/
/**
 * @Author: zhangqifeng
 * @Date: 2023/4/13 11:11
 * @Description:
 *//*



@RestController
@RequestMapping("/api/cache/")
public class CacheTest {

    @Autowired
    private RedissonClient redissonClient;

    @PostMapping("testLock")
    public String testRedissonLock() {
        RLock rlock = redissonClient.getLock("lock:test:rds");
        System.out.println(rlock);
        int lockTime = 300;
        String info = "";
        rlock.lock(lockTime, TimeUnit.SECONDS);
        try {
            int count = 0;
            for (int i = 0; i < 10000; i++) {
                count = i;
            }
            Thread.sleep(10000);
            info = String.valueOf(count);
        } catch (Exception e) {
            return "exception";
        } finally {
            rlock.unlock();
        }
        System.out.println("------------->" + info);
        return info;
    }
}
*/
